//
//  DebugNetWorkManager.h
//  YK_DebugManager
//
//  Created by edward on 2021/1/14.
//

#import <Foundation/Foundation.h>
@class DebugNetWorkModel;
NS_ASSUME_NONNULL_BEGIN

@interface DebugNetWorkManager : NSObject
@property (nonatomic,strong, readonly) NSMutableArray<DebugNetWorkModel *> *records;

///是否开启抓包  (不使用自己添加的保存网络请求)(默认开启)
@property(nonatomic,assign) BOOL isRecordNetWorking;

+ (instancetype)sharedInstance;

/// 保存当前网络请求
/// @param record 记录
- (void)saveRecord:(DebugNetWorkModel *)record;

/// 删除记录
/// @param index 删除当前内容
- (void)removeItemAtIndex:(NSInteger)index;

/// 删除所有记录
- (void)removeAllDatas;

@end

@interface DebugNetWorkModel : NSObject

/// 请求
@property(nonatomic,copy) NSURLRequest *request;
/// 请求ID
@property(nonatomic,copy) NSString *requestId;
/// 请求地址
@property(nonatomic,copy) NSString *url;
/// 请求模式
@property(nonatomic,copy) NSString *method;
/// 请求头
@property(nonatomic,copy) NSDictionary *allHttpHeader;
/// 请求体
@property(nonatomic,copy) NSData *requestBody;
/// 请求数据大小
@property(nonatomic,copy) NSString *uploadFlow;
/// mineType
@property(nonatomic,copy) NSString *mineType;
/// 响应
@property(nonatomic,copy) NSURLResponse *response;
/// 响应状态
@property(nonatomic,copy) NSString *statusCode;
/// 响应数据
@property(nonatomic,copy) NSData *responseData;
/// 响应体
@property(nonatomic,copy) NSString *responseBody;
/// 请求时长
@property(nonatomic,copy) NSString *totalDuration;
/// 开始时间
@property(nonatomic,copy) NSDate *startTime;
/// 响应时间
@property(nonatomic,copy) NSDate *endTime;
/// 响应梗要
@property(nonatomic,copy) NSString *downFlow;
/// 请求是否出错
@property(nonatomic,assign) BOOL isException;

@end

NS_ASSUME_NONNULL_END
